import request from '@/utils/request'

/**
 *查询字典列表
 * @param query
 * @param page
 */
export function getTableListApi(query,page) {
  const data = Object.assign(query,page);
  return request({
    url: '/sys-dict/page',
    method: 'POST',
    data,
  })
}



/**
 *查询详情
 * @param id
 */
export function getDetailInfoApi(id) {
  return request({
    url: `/sys-dict/getById/${id}`,
    method: 'get',
  })
}

/**
 *暂存 && 编辑
 * @param data
 */
export function addAndUpdateApi(data) {
  let url = "";
  if(!data.id){
    url = '/sys-dict/add';
  }else {
    url = '/sys-dict/update';
  }
  return request({
    url,
    method: 'POST',
    data,
  })
}

/**
 *删除
 * @param ids
 */
export function deleteApi(ids) {
  return request({
    url: '/sys-dict/delete',
    method: 'POST',
    data:ids,
  })
}
